package abstergo.tbs.betterasyc.AsycBase;

import android.widget.Toast;

public class DefaultErrorHandle<TP,TR> implements IAsycErrorAction<TP,TR> {

    Exception ex;

    @Override
    public int ErrorCode(Exception ex, TP[] params) {
        ex.printStackTrace();
        this.ex=ex;
        return 0;
    }

    @Override
    public void Handle(AsycResult<TR> bad, AsycWorker<TP,TR> owner) {
        if(owner.getContext()!=null)
            Toast.makeText(owner.getContext(),ex.getMessage(),Toast.LENGTH_SHORT).show();
    }
}
